<template>
  <div class="contain">
    <div class="contain-header">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>综合查询</el-breadcrumb-item>
        <el-breadcrumb-item>医生收入查询</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="contain-body">
      <div class="body-header">
        <el-form :inline="true" size="mini">
          <el-form-item label="医生姓名">
            <el-input placeholder="请输入医生姓名" v-model="page.realName"></el-input>
          </el-form-item>
          <el-form-item label="订单时间">
            <el-date-picker
                type="daterange"
                clearable
                value-format="yyyy-MM-dd"
                range-separator="至"
                start-placeholder="开始日期"
                v-model="page.times"
                end-placeholder="结束日期">
            </el-date-picker>
          </el-form-item>

          <el-form-item label="订单状态">
            <el-select placeholder="请选择订单状态" v-model="page.status" clearable>
              <el-option label="待接诊" value="2" key="2"></el-option>
              <el-option label="已接诊" value="3" key="3"></el-option>
              <el-option label="已完成" value="4" key="4"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" @click="findDoctorIncome">查 询</el-button>
            <el-button type="primary" icon="el-icon-refresh" @click="reset">刷 新</el-button>
          </el-form-item>
        </el-form>
      </div>
      <div class="body-table">
        <el-table
            :data="tableData"
            style="width: 100%">
          <el-table-column
              type="index"
              width="100px"
              label="序号"
              align="center"
          >
          </el-table-column>
          <el-table-column
              prop="doctorUser.realName"
              label="医生姓名"
              align="center"
          >
          </el-table-column>
          <el-table-column
              prop="orderNum"
              label="订单号"
              align="center"
          >
          </el-table-column>
          <el-table-column
              prop="client.realName"
              label="患者姓名"
              align="center"
          >
          </el-table-column>
          <el-table-column
              prop="deg"
              label="订单状态"
              align="center"
          >
            <template slot-scope="scope">
              <el-tag :type="scope.row.status === 2 ? 'info' : scope.row.status === 3 ? '' : 'success'">
                {{ scope.row.status === 2 ? '待接诊' : scope.row.status === 3 ? '已接诊' : '已完成' }}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column
              prop="consultationFee"
              label="订单金额"
              align="center"
          >
          </el-table-column>


        </el-table>
      </div>
      <div class="body-page">
        <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="page.pageIndex"
            :page-sizes="[10, 15, 20, 25]"
            :page-size="page.pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total">
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      tableData: [],
      page: {
        pageIndex: 1,
        pageSize: 10,
        realName: null,
        times: [],
        status: null
      },
      total: 0,
    }
  },
  created() {
    this.findDoctorIncome()
  },
  methods: {
    reset() {
      this.page.pageIndex = 1
      this.page.pageSize = 10
      this.page.realName = null
      this.page.times = []
      this.page.status = null
      this.findDoctorIncome()
    },
    handleSizeChange(val) {
      this.page.pageSize = val
      this.findDoctorIncome()
    },
    handleCurrentChange(val) {
      this.page.pageIndex = val
      this.findDoctorIncome()
    },
    findDoctorIncome() {
      this.axios.post('/admin-doctor/findDoctorIncome', this.page).then(res => {
        if (res.data.code === 200) {
          this.tableData = res.data.data.data
          this.total = res.data.data.total
        }
      })
    }
  },
}
</script>

<style scoped lang="less">
.contain {
  width: 100%;
  height: 100%;

  .contain-header {
    width: 100%;
    height: 50px;
    display: flex;
    align-items: center;
  }

  .contain-body {
    width: 100%;
    height: calc(100% - 50px);
    background-color: #fff;
    padding: 1%;
    box-sizing: border-box;

    .body-header {
      width: 100%;
      height: 50px;
    }

    .body-table {
      width: 100%;
      height: calc(100% - 120px);
    }

    .body-page {
      width: 100%;
      height: 70px;
      display: flex;
      align-items: center;
    }
  }
}
</style>
